/**
 * @author徐航
 * 设置界面
 */
cc.Class({
    extends: cc.Component,
    properties: {
        noticeOff: cc.Node,
        noticeOn: cc.Node,
        loginOutView: cc.Node,
        kefuView: cc.Node,
        kefuLabel: cc.Label
    },

    start() {
        this.updateBtnState();
        this.kefuLabel.string = '您好！如果注销账号请您发送本账号ID:' + cc.sys.localStorage.getItem('user_id') + '到客服邮箱kefu6968@qq.com，我们将尽快为您处理！'
    },

    onClickNotice() {
        var notice = cc.sys.localStorage.getItem('noticeState') > 0;
        notice = !notice;
        cc.sys.localStorage.setItem('noticeState', notice ? 1 : -1);
        this.updateBtnState();
    },

    updateBtnState() {
        var notice = cc.sys.localStorage.getItem('noticeState') > 0;
        this.noticeOff.active = notice > 0;
        this.noticeOn.active = !notice > 0;
    },

    openLoginOut() {
        this.loginOutView.active = true;
    },

    closeLoginOut() {
        this.loginOutView.active = false
    },

    openKefuView() {
        this.kefuView.active = true;
    },

    closeKefuView() {
        this.kefuView.active = false;
    }
})